<template>
  <div>
    <el-drawer
      title=""
      :visible.sync="drawer"
      :direction="direction"
      :before-close="handleClose"
      custom-class="drawer-info"
    >
      <div class="info-item">
        <h5 class="from-title">基本信息</h5>
        <div class="form-item">
          <label class="form-item-label">文件名:</label>
          <div class="form-item-content">
            {{ objInfo.resourceName }}
            <fortress-copy :copyData="objInfo.resourceName"></fortress-copy>
          </div>
        </div>
        <div class="form-item">
          <label class="form-item-label">文件地址:</label>
          <div class="form-item-content">
            {{ objInfo.resourceUrl }}
            <fortress-copy :copyData="objInfo.resourceUrl"></fortress-copy>
          </div>
        </div>
        <div class="form-item">
          <label class="form-item-label">平台类型:</label>
          <div class="form-item-content">{{ objInfo.ossPlatformName }}</div>
        </div>
        <!-- <div class="form-item">
                    <label class="form-item-label">创建者:</label>
                    <div class="form-item-content">{{ objInfo.createUserName }}</div>
                </div> -->
        <div class="form-item">
          <label class="form-item-label">创建时间:</label>
          <div class="form-item-content">{{ objInfo.createTime }}</div>
        </div>
        <!-- <div class="form-item">
                    <label class="form-item-label">用户类型:</label>
                    <div class="form-item-content">{{ objInfo.userTypeName }}</div>
                </div> -->
      </div>
    </el-drawer>
  </div>
</template>
<script>
import { sysossrecordInfo } from "@/api/system/sysossrecord.js";
import { enumList, } from "@/api/public.api.js";
export default {
  data() {
    return {
      drawer: true,
      direction: "rtl",
      objInfo: {},
      OssList: [],
      UserTypeList: [],
    }
  },
  created() {
  },
  methods: {
    queryEnumList() {
      this.OssList = [];
      enumList("Oss", "").then((resp) => {
        if (resp.code == 0) {
          this.OssList = resp.data;
        }
      });
      this.UserTypeList = [];
      enumList("UserType", "").then((resp) => {
        if (resp.code == 0) {
          this.UserTypeList = resp.data;
        }
      });
    },
    init(id) {
      this.queryEnumList();
      if (id) {
        sysossrecordInfo(id).then(res => {
          this.objInfo = res.data
          let ossPlatformObj = this.OssList.find((item) => {
            return item.code == this.objInfo.ossPlatform;
          });
          this.objInfo.ossPlatformName = ossPlatformObj ? ossPlatformObj.name : "";
          let userTypeObj = this.UserTypeList.find((item) => {
            return item.code == this.objInfo.userType;
          });
          this.objInfo.userTypeName = userTypeObj ? userTypeObj.name : "";
          if (this.objInfo.ossPlatform == 1) {
            this.objInfo.resourceUrl = this.$store.state.prefixUrl + this.objInfo.resourceUrl
          }
        })

      }
      this.drawer = true
    },
    // 关闭抽屉
    handleClose(done) {
      done()
    },
  },
}
</script>
<style scoped>
.from-title {
  margin-bottom: 20px;
  padding: 0 20px 20px 20px;
  font-size: 16px;
  color: #17233d;
  border-bottom: 1px solid #eee;
}
.info-item {
  margin-bottom: 40px;
}

.form-item {
  margin-bottom: 20px;
  font-size: 14px;
}
.form-item-label {
  text-align: right;
  float: left;
  width: 25%;
}
.form-item-content {
  margin-left: 30%;
  width: 70%;
}
</style>
